SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO
















alter procedure p_getmnfrawprice (
  @btype integer,
  @bdate datetime, 
  @bid integer,
  @bno integer,
  @bdtlno integer,
  @result integer out,
  @amount decimal(18,2) out
)
as  

begin
  set nocount on
  exec p_getmnfunassignamt @btype,@bdate,@bid,@bno,@bdtlno,@amount output

  if (@amount = 0)
  begin
    select @amount = isnull(sum(round(a.price*m.quantity,2)),0)
      from tt_bill a
      inner join tb_mnfcheckacceptbatch m on (m.relationpid=a.tid)
      where m.bid=@bid and m.bno=@bno and m.bdtlno=@bdtlno
    set @amount=isnull(@amount,0)
  end
  set @result = 0
end











GO
SET QUOTED_IDENTIFIER OFF 
GO
SET ANSI_NULLS ON 
GO

